package com.example.boot.factorycase;

import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.*;

@Slf4j
@Service
public class ScoreInvoker {

    public void userRiskScoreCheck(String number) {
        List<String> list = Lists.newArrayList("TD", "BR");

        String supplier = list.get(new Random().nextInt(2));

        AbstractPreCheckScoreCollector collector = PreCheckScoreCollectorFactory.getCollector(supplier);
        log.info("{}={}", Thread.currentThread().getName(), supplier);
        collector.buildParams(number, supplier);

        collector.process(number);
    }

}
